<?php

class Application_Form_SuppressionMembreForm extends Zend_Form
{
  public function init()
  {
    $this->setName('suppressionmembre');
    $r = new Application_Model_RolesUsers();
    $vendeurs = $r->getVendeurs($_SESSION['user']->getGroupeActif()->getID());

    $id = new Zend_Form_Element_Hidden('id');
    $id->addFilter('Int')
      ->setDecorators(array('ViewHelper','FormErrors'));
    $this->addElement($id);

    $formname = new Zend_Form_Element_Hidden('formname');
    $formname->setValue('suppression');
    $this->addElement($formname);

    foreach($vendeurs as $m)
      {
	$vendeur = new Zend_Form_Element_Checkbox($m);
	$vendeur->setLabel($m)
	  ->setValue(0)
	  ->setDecorators(array('ViewHelper','FormErrors','Label','Errors'));
	$this->addElement($vendeur);
      }

    $send = new Zend_Form_Element_Submit('send');
    $send->setLabel('Suppression')
      ->setDecorators(array('ViewHelper','FormErrors','Errors'));
    if(count($vendeurs) == 0)
      {
	echo "<script language=\"javascript\">Disabled('send');</script>";
      }
    $this->addElement($send);
  }
}